{% extends 'home.html' %}
{% block content-title %}
    <title>添加图书</title>
{% endblock %}
{% block content_main %}
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">添加图书</h3>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" method="post" action="">
                <div class="form-group">
                    <label for="InputName" class="col-sm-2 control-label">书名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="InputName" name="title"
                               placeholder="please enter title">
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputPrice" class="col-sm-2 control-label">价格</label>
                    <div class="col-sm-10">
                        <div class="col-sm-12 input-group">
                            <input type="text" class="form-control" pattern="[0-9]*[.]?[0-9]+" id="InputPrice"
                                   name="price" placeholder="please enter price">
                            <div class="input-group-addon">￥</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputImage" class="col-sm-2 control-label">书籍封面</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="InputImage" name="image"
                               placeholder="please enter image url">
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputDetail" class="col-sm-2 control-label">书籍详细网址</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="InputDetail" name="detail_url"
                               placeholder="please enter book url">
                    </div>
                </div>

                <div class="form-group">
                    <label for="InputDesc" class="col-sm-2 control-label">书籍简介</label>
                    <div class="col-sm-10">
                        <textarea name="desc" id="InputDesc" class="form-control"
                                  placeholder="please enter book introduction"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputWordCount" class="col-sm-2 control-label">书籍字数</label>
                    <div class="col-sm-10">
                        <div class="col-sm-12 input-group">
                            <input type="text" class="form-control" pattern="[0-9]*[.]?[0-9]+" id="InputWordCount"
                                   name="word_count" placeholder="please enter word_count">
                            <div class="input-group-addon">万字</div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputDate" class="col-sm-2 control-label">出版日期</label>
                    <div class="col-sm-10">
                        <input type="date" class="form-control" id="InputDate" name="register_date">
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputAuthor" class="col-sm-2 control-label">作者</label>
                    <div class="col-sm-10 checkbox">
                        <div class="col-sm-12">
                            {% for author in author_all %}
                                <input type="checkbox" id="InputAuthor" name="author_id" value="{{ author.pk }}">
                                {{ author.name }}&emsp;&emsp;&emsp;
                            {% endfor %}
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="InputPublish" class="col-sm-2 control-label">出版社</label>
                    <div class="col-sm-10 radio">
                        <div class="col-sm-12">
                            {% for publish in publish_all %}
                                <input type="radio" id="InputPublish" name="publish_id" value="{{ publish.pk }}">
                                {{ publish.name }}&emsp;&emsp;&emsp;
                            {% endfor %}
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input type="submit">
                    </div>
                </div>
            </form>
        </div>

    </div>

{% endblock %}